Skip to content

PHPLIB-324: Cache extension installation for Travis CI jobs #493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 12, 2018

Conversation

kvwalker
Copy link
Contributor

@kvwalker kvwalker commented Feb 9, 2018

@kvwalker kvwalker requested a review from jmikola February 9, 2018 21:55
.travis.yml Outdated
# tpecl is a helper to compile and cache php extensions
tpecl () {
local ext_name=ext-mongodb
local ext_so=mongodb.so
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd suggest we just copy the tpecl() definition from https://github.com/symfony/symfony/blob/32cc2e06a326b1dd888c02e1cc48988a14cb9a65/.travis.yml#L101 completely and parametrize the extension name and merge when invoking the tpecl function.

cp $ext_dir/$ext_so $ext_cache
fi
}
export -f tpecl
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before_script below is still using pecl install, so that will need to be changed to tpecl (see: https://github.com/symfony/symfony/blob/32cc2e06a326b1dd888c02e1cc48988a14cb9a65/.travis.yml#L137). I don't think we need to bother with tfold right now to collapse Travis CI log output; that's something we can always follow up with in the future.

Calling tpecl with the extension name (usual argument to pecl install) and .so filename should suffice:

tpecl mongodb-${DRIVER_VERSION} mongodb.so

local ext_name=$1
local ext_so=$2
local ext_dir=$(php -r "echo ini_get('extension_dir');")
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed this earlier but we'll also need to add php-ext to the list of cached directories further up in the Travis config. See: https://github.com/symfony/symfony/blob/32cc2e06a326b1dd888c02e1cc48988a14cb9a65/.travis.yml#L35. The following should suffice:

- ${HOME}/php-ext

local ext_dir=$(php -r "echo ini_get('extension_dir');")
local ext_cache=~/php-ext/$(basename $ext_dir)/$ext_name
if [[ -e $ext_cache/$ext_so ]]; then
echo extension = $ext_cache/$ext_so >> $INI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This depends on an INI variable being defined. Let's add this line before defining tpecl(): https://github.com/symfony/symfony/blob/32cc2e06a326b1dd888c02e1cc48988a14cb9a65/.travis.yml#L91

@kvwalker kvwalker merged commit 181b3c0 into mongodb:master Feb 12, 2018
kvwalker added a commit that referenced this pull request Feb 12, 2018
@kvwalker kvwalker deleted the PHPLIB-324 branch February 12, 2018 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants